import 'package:dio/dio.dart';

import 'dio/BaseModel.dart';
import 'dio/DioClient.dart';

class DeviceApi {


  Future<BaseModel> updateDevice(Map<String, dynamic> formData) async {
    BaseModel response =  await DioClient().doDio(
        "/device/updateDevice",
        method: HTTPMethod.post,
        data: formData,
        loading: true
    );
    return response;
  }

  //室内机锁延时
  Future<BaseModel> indoorLockDelay(Map<String, dynamic> formData) async {
    BaseModel response =  await DioClient().doDio(
        "/device/indoorLockDelay",
        method: HTTPMethod.post,
        data: formData,
        loading: true
    );
    return response;
  }



  //时间水印
  Future<BaseModel> timeWaterMark(Map<String, dynamic> formData) async {
    BaseModel response =  await DioClient().doDio(
        "/device/timeWaterMark",
        method: HTTPMethod.post,
        data: formData,
        loading: true
    );
    return response;
  }

  //对讲方式设置
  Future<BaseModel> interComMode(Map<String, dynamic> formData) async {
    BaseModel response =  await DioClient().doDio(
        "/device/interComMode",
        method: HTTPMethod.post,
        data: formData,
        loading: true
    );
    return response;
  }


  //格式化
  Future<BaseModel> format(Map<String, dynamic> formData) async {
    BaseModel response =  await DioClient().doDio(
        "/device/format",
        method: HTTPMethod.post,
        data: formData,
        loading: true
    );
    return response;
  }


  //同步设备时间
  Future<BaseModel> syncTime(Map<String, dynamic> formData) async {
    BaseModel response =  await DioClient().doDio(
        "/device/syncTime",
        method: HTTPMethod.post,
        data: formData,
        loading: true
    );
    return response;
  }

  //重启
  Future<BaseModel> reboot(Map<String, dynamic> formData) async {
    BaseModel response =  await DioClient().doDio(
        "/device/reboot",
        method: HTTPMethod.post,
        data: formData,
        loading: true
    );
    return response;
  }

  //开锁
  Future<BaseModel> openDoor(Map<String, dynamic> formData) async {
    BaseModel response =  await DioClient().doDio(
        "/device/openDoor",
        method: HTTPMethod.post,
        data: formData,
        loading: true
    );
    return response;
  }

  //恢复出厂
  Future<BaseModel> restoreFactory(Map<String, dynamic> formData) async {
    BaseModel response =  await DioClient().doDio(
        "/device/restoreFactory",
        method: HTTPMethod.post,
        data: formData,
        loading: true
    );
    return response;
  }


  Future<BaseModel> addDevice(Map<String, dynamic> formData) async {
    BaseModel response =  await DioClient().doDio(
        "/device/addDevice",
        method: HTTPMethod.post,
        data: formData,
        loading: true);
    return response;
  }




  //获取设备列表
  Future<BaseModel> getDeviceData(int userId) async {
    BaseModel response =  await DioClient().doDio(
        "/device/list?userId=$userId",
        method: HTTPMethod.get,
        loading: true
    );

    return response;
  }




  Future<BaseModel> getMontionDetection() async {
    // 发送PUT请求并传递FormData
    BaseModel response = await DioClient().doDio(
        "/device/getMontionDetection",
        method: HTTPMethod.get,
        // data: formData, // 使用FormData作为数据
        loading: true
    );
    return response;
  }



  Future<BaseModel> getDefenseSetting() async {


    // 发送PUT请求并传递FormData
    BaseModel response = await DioClient().doDio(
        "/device/getDefenseSetting",
        method: HTTPMethod.get,
        // data: formData, // 使用FormData作为数据
        loading: true
    );
    return response;
  }



  Future<BaseModel> getDeviceInfo(int deviceId) async {
    // 发送PUT请求并传递FormData
    BaseModel response = await DioClient().doDio(
        "/device/getInfo/$deviceId",
        method: HTTPMethod.get,
        // data: formData, // 使用FormData作为数据
        loading: true
    );
    return response;
  }

  Future<BaseModel> deleteById(int deviceId) async {
    // 发送PUT请求并传递FormData
    BaseModel response = await DioClient().doDio(
        "/device/deleteById/$deviceId",
        method: HTTPMethod.get,
        // data: formData, // 使用FormData作为数据
        loading: true
    );
    return response;
  }




  Future<BaseModel> getDeviceAlarm(int deviceId) async {

    // 发送PUT请求并传递FormData
    BaseModel response = await DioClient().doDio(
        "/alarm/list?deviceId=$deviceId",
        method: HTTPMethod.get,
        // data: formData, // 使用FormData作为数据
        loading: true
    );
    return response;
  }



  //呼叫消息
  Future<BaseModel> callMessage(Map<String, dynamic> formData) async {
    BaseModel response =  await DioClient().doDio(
        "/message/callMessage",
        method: HTTPMethod.post,
        data: formData,
        loading: true
    );
    return response;
  }







}